<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小兔鲜儿官网 - 冯柏源 22215220432</title>
    <style>
        /* 全局样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        /* 导航栏 */
        .navbar {
            background: #fff;
            padding: 1rem 5%;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 1.5rem;
            color: #e4393c;
            font-weight: bold;
        }

        .nav-menu {
            display: flex;
            gap: 2rem;
        }

        .nav-menu a {
            text-decoration: none;
            color: #333;
            transition: color 0.3s;
        }

        .nav-menu a:hover {
            color: #e4393c;
        }

        /* 轮播图 */
        .carousel {
            width: 100%;
            height: 400px;
            position: relative;
            overflow: hidden;
        }

        .slide {
            position: absolute;
            width: 100%;
            height: 100%;
            opacity: 0;
            transition: opacity 1s ease-in-out;
        }

        .slide.active {
            opacity: 1;
        }

        .slide img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* 商品展示区 */
        .product-grid {
            padding: 2rem 5%;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 2rem;
        }

        .product-card {
            border: 1px solid #eee;
            border-radius: 8px;
            overflow: hidden;
            transition: transform 0.3s;
        }

        .product-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }

        .product-img {
            height: 200px;
            background: #f5f5f5;
        }

        .product-info {
            padding: 1rem;
        }

        /* 响应式布局 */
        @media (max-width: 768px) {
            .product-grid {
                grid-template-columns: 1fr;
            }

            .nav-menu {
                display: none;
            }
        }

        /* 页脚 */
        footer {
            background: #333;
            color: #fff;
            padding: 2rem 5%;
            text-align: center;
        }

        .student-info {
            font-size: 1.2rem;
            margin-top: 1rem;
            color: #e4393c;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="logo">小兔鲜儿</div>
        <div class="nav-menu">
            <a href="#home">首页</a>
            <a href="#products">商品分类</a>
            <a href="#cart">购物车</a>
            <a href="#login">登录</a>
        </div>
    </nav>

    <!-- 轮播图 -->
    <div class="carousel">
        <div class="slide active">
            <img src="https://picsum.photos/1200/400?random=1" alt="商品1">
        </div>
        <div class="slide">
            <img src="https://picsum.photos/1200/400?random=2" alt="商品2">
        </div>
        <div class="slide">
            <img src="https://picsum.photos/1200/400?random=3" alt="商品3">
        </div>
    </div>

    <!-- 商品展示 -->
    <div class="product-grid">
        <div class="product-card">
            <div class="product-img">
                <img src="https://picsum.photos/300/200?random=4" alt="商品">
            </div>
            <div class="product-info">
                <h3>新鲜草莓</h3>
                <p>¥29.9/500g</p>
            </div>
        </div>
        <!-- 重复更多商品卡片 -->
    </div>

    <!-- 页脚 -->
    <footer>
        <p>© 2025 小兔鲜儿 版权所有</p>
        <p>联系邮箱：service@xiaotu.com</p>
        <div class="student-info">
            开发者：冯柏源 | 学号：22215220432
        </div>
    </footer>

    <script>
        // 轮播图逻辑
        let currentSlide = 0;
        const slides = document.querySelectorAll('.slide');
        
        function nextSlide() {
            slides[currentSlide].classList.remove('active');
            currentSlide = (currentSlide + 1) % slides.length;
            slides[currentSlide].classList.add('active');
        }

        setInterval(nextSlide, 3000);

        // 表单验证（示例）
        document.querySelector('#login-form').addEventListener('submit', (e) => {
            const email = document.querySelector('#email').value;
            if (!/^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/.test(email)) {
                e.preventDefault();
                alert('请输入有效的邮箱地址');
            }
        });
    </script>
</body>
</html>
